<template>
	<div class="v-bgd">
		<view class="notice-title">
			{{lastNotice.title}}
		</view>
		<view class="notice-about">
			<text class="notice-time">{{lastNotice.time}}</text>
			<text class="notice-author">{{lastNotice.author}}</text>
		</view>
		<view class="notice-content">
			{{lastNotice.content}}
		</view>
	</div>

</template>

<script>
	export default {
		onLoad(options) {
			let nid = options.nid;
			// 通过nid向数据库查询notice
			for (let i = 0; i < this.noticeList.length; i++) {
				if (this.noticeList[i].nid == nid) {
					this.lastNotice = this.noticeList[i]
				}
			}
			console.log(this.lastNotice)
		},

		data() {
			return {
				noticeList: [{
					nid: "1",
					title: "同心协力抗疫！",
					time:"2020-04-20",
					author:"三农公告",
					content: "同心协力抗疫，自觉从我做起！同心协力抗疫，自觉从我做起！"
				}],
				lastNotice: {}
			}
		}
	}
</script>

<style>
	.notice-title {
		line-height: 100rpx;
		font-size: 42rpx;
		letter-spacing: 10rpx;
		text-align: center;
	}

	.notice-about {
		line-height: 80rpx;
	}

	.notice-time {
		color: rgb(166, 166, 166);
		padding-right: 10rpx;
	}
	
	.notice-author {
		color: #82A4C3;
	}

	.notice-content {
		line-height: 80rpx;
		padding-bottom: 30rpx;
		text-indent: 2em;
	}
</style>
